<?php
/**
 * Core_Record_Source_Table
 * 
 * @author naspeh
 * @version $Id: Table.php 658 2008-06-13 14:24:51Z naspeh $
 */
class Core_Record_Source_Table extends Core_Record_Source_Abstract
{
    /**
     * Table
     *
     * @var Zend_Db_Table_Abstract
     */
    protected $_table;
    /**
     * Конструктор
     *
     * @param Zend_Db_Table_Abstract $table
     */
    public function __construct(Zend_Db_Table_Abstract $table)
    {
        $this->_table = $table;
    }
    /**
     * Возвращает список доступных полей
     *
     * @return array
     */    
    protected function _getFields()
    {
        return $this->_table->info('cols');
    }
    /**
     * Возвращает все стороки 
     *
     * @param string|array|Zend_Db_Table_Select $where  OPTIONAL An SQL WHERE clause or Zend_Db_Table_Select object.
     * @param string|array                      $order  OPTIONAL An SQL ORDER clause.
     * @param int                               $count  OPTIONAL An SQL LIMIT count.
     * @param int                               $offset OPTIONAL An SQL LIMIT offset.
     * @return array
     */
    public function fetchAll($where = null, $order = null, $count = null, $offset = null)
    {
        return $this->_table->fetchAll($where, $order, $count, $offset)->toArray();
    }
}